<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: JakesFadingMapping Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00115.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pro-static-attribs">Static Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">JakesFadingMapping Class Reference<div class="ingroups"><a class="el" href="a00511.html">analogueModels - AnalogueModel implementations</a> &#124; <a class="el" href="a00519.html">mapping - classes representing mathematical mappings</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="JakesFadingMapping" --><!-- doxytag: inherits="SimpleConstMapping" -->
<p><a class="el" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a> used to represent attenuation of a signal by <a class="el" href="a00114.html" title="Implements Rayleigh fading after Jakes&#39; model.">JakesFading</a>.  
 <a href="a00115.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00398_source.html">JakesFading.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for JakesFadingMapping:</div>
<div class="dyncontent">
<div class="center"><img src="a00801.png" border="0" usemap="#JakesFadingMapping_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for JakesFadingMapping:</div>
<div class="dyncontent">
<div class="center"><img src="a00802.png" border="0" usemap="#JakesFadingMapping_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00803.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5feea6585c074e1dab16486600db7a25"></a><!-- doxytag: member="JakesFadingMapping::JakesFadingMapping" ref="a5feea6585c074e1dab16486600db7a25" args="(JakesFading *model, double relSpeed, const Argument &amp;start, const Argument &amp;interval, const Argument &amp;end)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#a5feea6585c074e1dab16486600db7a25">JakesFadingMapping</a> (<a class="el" href="a00114.html">JakesFading</a> *<a class="el" href="a00115.html#afe3bf29047cfa0f35c20926441261738">model</a>, double <a class="el" href="a00115.html#a02aab24700471b25a801010842d54cea">relSpeed</a>, const <a class="el" href="a00013.html">Argument</a> &amp;start, const <a class="el" href="a00013.html">Argument</a> &amp;interval, const <a class="el" href="a00013.html">Argument</a> &amp;end)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Takes the model, the relative speed between two hosts and the interval in which to create key entries. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aab1ea80168059a8f31e2c82629794d1e"></a><!-- doxytag: member="JakesFadingMapping::JakesFadingMapping" ref="aab1ea80168059a8f31e2c82629794d1e" args="(const JakesFadingMapping &amp;o)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>JakesFadingMapping</b> (const <a class="el" href="a00115.html">JakesFadingMapping</a> &amp;o)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#a23e8978d7aab4509f846ac6a8044de19">getValue</a> (const <a class="el" href="a00013.html">Argument</a> &amp;pos) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the value of the mapping at the passed position.  <a href="#a23e8978d7aab4509f846ac6a8044de19"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00058.html">ConstMapping</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#ab8c347fa961711d3fd2c86b425cddc53">constClone</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">creates a clone of this mapping.  <a href="#ab8c347fa961711d3fd2c86b425cddc53"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afe3bf29047cfa0f35c20926441261738"></a><!-- doxytag: member="JakesFadingMapping::model" ref="afe3bf29047cfa0f35c20926441261738" args="" -->
<a class="el" href="a00114.html">JakesFading</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#afe3bf29047cfa0f35c20926441261738">model</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to the model. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a02aab24700471b25a801010842d54cea"></a><!-- doxytag: member="JakesFadingMapping::relSpeed" ref="a02aab24700471b25a801010842d54cea" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#a02aab24700471b25a801010842d54cea">relSpeed</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The relative speed between the two hosts for this attenuation. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-static-attribs"></a>
Static Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a52281acdf3981141a525adb9e18792e0"></a><!-- doxytag: member="JakesFadingMapping::dimensions" ref="a52281acdf3981141a525adb9e18792e0" args="" -->
static <a class="el" href="a00086.html">DimensionSet</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#a52281acdf3981141a525adb9e18792e0">dimensions</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The dimensions of this mappings domain. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0e3e3c6d08f5fa391c738fd773708c47"></a><!-- doxytag: member="JakesFadingMapping::operator=" ref="a0e3e3c6d08f5fa391c738fd773708c47" args="(const JakesFadingMapping &amp;)" -->
<a class="el" href="a00115.html">JakesFadingMapping</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00115.html#a0e3e3c6d08f5fa391c738fd773708c47">operator=</a> (const <a class="el" href="a00115.html">JakesFadingMapping</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p><a class="el" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a> used to represent attenuation of a signal by <a class="el" href="a00114.html" title="Implements Rayleigh fading after Jakes&#39; model.">JakesFading</a>. </p>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ab8c347fa961711d3fd2c86b425cddc53"></a><!-- doxytag: member="JakesFadingMapping::constClone" ref="ab8c347fa961711d3fd2c86b425cddc53" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00058.html">ConstMapping</a>* JakesFadingMapping::constClone </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>creates a clone of this mapping. </p>
<p>This method has to be implemented by every subclass. But most time the implementation will look like the implementation of this method (except of the class name). </p>

<p>Implements <a class="el" href="a00194.html#a49da397ee4ea25a6bdcf7f08dc6e2ed5">SimpleConstMapping</a>.</p>
<div class="fragment"><pre class="fragment">  {
    <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="a00115.html#a5feea6585c074e1dab16486600db7a25" title="Takes the model, the relative speed between two hosts and the interval in which to create key entries...">JakesFadingMapping</a>(*<span class="keyword">this</span>);
  }
</pre></div>
</div>
</div>
<a class="anchor" id="a23e8978d7aab4509f846ac6a8044de19"></a><!-- doxytag: member="JakesFadingMapping::getValue" ref="a23e8978d7aab4509f846ac6a8044de19" args="(const Argument &amp;pos) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">double JakesFadingMapping::getValue </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00013.html">Argument</a> &amp;&#160;</td>
          <td class="paramname"><em>pos</em></td><td>)</td>
          <td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the value of the mapping at the passed position. </p>
<p>This method has to be implemented by every subclass and should only have constant complexity. </p>

<p>Implements <a class="el" href="a00194.html#aeb10c744b8f4c6df092332b6228e209e">SimpleConstMapping</a>.</p>

<p>References <a class="el" href="a00114.html#a7f9a358fb5cdfd19e6d1e7c97627ad4f">JakesFading::angleOfArrival</a>, <a class="el" href="a00114.html#a8c91a22de8e520176877f7421d033ae7">JakesFading::carrierFrequency</a>, <a class="el" href="a00114.html#a2f0c52cb4f441a2abba9aec17194fb66">JakesFading::delay</a>, <a class="el" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95">JakesFading::fadingPaths</a>, <a class="el" href="a00013.html#a2ecb3b041b5b8721d6767531e4ac792a">Argument::getTime()</a>, <a class="el" href="a00115.html#afe3bf29047cfa0f35c20926441261738">model</a>, <a class="el" href="a00115.html#a02aab24700471b25a801010842d54cea">relSpeed</a>, and <a class="el" href="a00030.html#a84d040f815027b3098451b02733ac63d">BaseWorldUtility::speedOfLight</a>.</p>
<div class="fragment"><pre class="fragment">                                                             {
  <span class="keywordtype">double</span>    f    = <a class="code" href="a00115.html#afe3bf29047cfa0f35c20926441261738" title="Pointer to the model.">model</a>-&gt;<a class="code" href="a00114.html#a8c91a22de8e520176877f7421d033ae7" title="Carrier frequency to be used.">carrierFrequency</a>;
  <span class="keywordtype">double</span>    v    = <a class="code" href="a00115.html#a02aab24700471b25a801010842d54cea" title="The relative speed between the two hosts for this attenuation.">relSpeed</a>;
  simtime_t t    = pos.<a class="code" href="a00013.html#a2ecb3b041b5b8721d6767531e4ac792a" title="Returns the time value of this argument.">getTime</a>();
  <span class="keywordtype">double</span>    re_h = 0;
  <span class="keywordtype">double</span>    im_h = 0;

  <span class="comment">// Compute Doppler shift.</span>
  <span class="keywordtype">double</span> doppler_shift = v * f / <a class="code" href="a00030.html#a84d040f815027b3098451b02733ac63d" title="Speed of light in meters per second.">BaseWorldUtility::speedOfLight</a>;

  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="a00115.html#afe3bf29047cfa0f35c20926441261738" title="Pointer to the model.">model</a>-&gt;<a class="code" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95" title="Number of fading paths used.">fadingPaths</a>; i++) {
    <span class="comment">// Some math for complex numbers:</span>
    <span class="comment">//</span>
    <span class="comment">// Cartesian form: z = a + ib</span>
    <span class="comment">// Polar form:     z = p * e^i(phi)</span>
    <span class="comment">//</span>
    <span class="comment">// a = p * cos(phi)</span>
    <span class="comment">// b = p * sin(phi)</span>
    <span class="comment">// z1 * z2 = p1 * p2 * e^i(phi1 + phi2)</span>

    <span class="comment">// Phase shift due to Doppler =&gt; t-selectivity.</span>
    <span class="keywordtype">double</span> phi_d = <a class="code" href="a00115.html#afe3bf29047cfa0f35c20926441261738" title="Pointer to the model.">model</a>-&gt;<a class="code" href="a00114.html#a7f9a358fb5cdfd19e6d1e7c97627ad4f" title="Angle of arrival on a fading path used for Doppler shift calculation.">angleOfArrival</a>[i] * doppler_shift;
    <span class="comment">// Phase shift due to delay spread =&gt; f-selectivity.</span>
    <span class="keywordtype">double</span> phi_i = SIMTIME_DBL(<a class="code" href="a00115.html#afe3bf29047cfa0f35c20926441261738" title="Pointer to the model.">model</a>-&gt;<a class="code" href="a00114.html#a2f0c52cb4f441a2abba9aec17194fb66" title="Delay on a fading path.">delay</a>[i]) * f;
    <span class="comment">// Calculate resulting phase due to t-selective and f-selective fading.</span>
    <span class="keywordtype">double</span> phi   = 2.00 * M_PI * (phi_d * SIMTIME_DBL(t) - phi_i);

    <span class="comment">// One ring model/Clarke&#39;s model plus f-selectivity according to Cavers:</span>
    <span class="comment">// Due to isotropic antenna gain pattern on all paths only a^2 can be received on all paths.</span>
    <span class="comment">// Since we are interested in attenuation a:=1, attenuation per path is then:</span>
    <span class="keywordtype">double</span> attenuation = (1.00 / sqrt(static_cast&lt;double&gt;(<a class="code" href="a00115.html#afe3bf29047cfa0f35c20926441261738" title="Pointer to the model.">model</a>-&gt;<a class="code" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95" title="Number of fading paths used.">fadingPaths</a>)));

    <span class="comment">// Convert to cartesian form and aggregate {Re, Im} over all fading paths.</span>
    re_h = re_h + attenuation * cos(phi);
    im_h = im_h - attenuation * sin(phi);
  }

  <span class="comment">// Output: |H_f|^2 = absolute channel impulse response due to fading.</span>
  <span class="comment">// Note that this may be &gt;1 due to constructive interference.</span>
  <span class="keywordflow">return</span> re_h * re_h + im_h * im_h;
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/analogueModel/<a class="el" href="a00398_source.html">JakesFading.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/analogueModel/JakesFading.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00115.html">JakesFadingMapping</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:32 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
